package com.an.cloud.service;

import com.an.cloud.entities.Pay;
import com.an.cloud.mapper.PayMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PayServiceImpl implements PayService {
    @Resource
    private PayMapper payMapper;

    /**
     * 添加
     *
     * @param pay 支付
     * @return int
     * @author: ANHE
     * @createDate: 2024/03/13
     * @version: 1.0.0
     */
    @Override
    public int add(Pay pay) {
        return payMapper.insertSelective(pay);
    }

    /**
     * 删除
     *
     * @param id id
     * @return int
     * @author: ANHE
     * @createDate: 2024/03/13
     * @version: 1.0.0
     */
    @Override
    public int delete(Integer id) {
        return payMapper.deleteByPrimaryKey(id);
    }

    /**
     * 更新
     *
     * @param pay 支付
     * @return int
     * @author: ANHE
     * @createDate: 2024/03/13
     * @version: 1.0.0
     */
    @Override
    public int update(Pay pay) {
        return payMapper.updateByPrimaryKeySelective(pay);
    }

    /**
     * 按身份证领取
     *
     * @param id id
     * @return {@link Pay }
     * @author: ANHE
     * @createDate: 2024/03/13
     * @version: 1.0.0
     */
    @Override
    public Pay getById(Integer id) {
        return payMapper.selectByPrimaryKey(id);
    }

    /**
     * 得到所有
     *
     * @return {@link List }<{@link Pay }>
     * @author: ANHE
     * @createDate: 2024/03/13
     * @version: 1.0.0
     */
    @Override
    public List<Pay> getAll() {
        return payMapper.selectAll();
    }
}
